﻿//Orginal date made: 3rd March 2012
//Creator: by Luke Bermingham

//Last modified:
//Modifier name:

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace DataLoadingModule.Model
{
    class DatasetModel
    {
        //This is the model for the custom data set loaded in by the user
        //The dataset is loaded by the user and is then parsed by the parser

        private string _datasetPath; //The path where the dataset is located
        public string DatasetPath
        {
            get
            {
                if(string.IsNullOrEmpty(_datasetPath))
                {
                    _datasetPath = "No file selected...";
                }
                return _datasetPath;
            } 
            set { _datasetPath = value; }
        }

        private char _delimeter = '\0'; //the delimiting character in the dataset
        public char Delimeter
        {
            get
            {
                if (_delimeter == '\0')
                {
                    _delimeter = ";"[0]; //semi colon is the default delimeter
                }
                return _delimeter;
            }
            set { _delimeter = value; }
        }

        public readonly ObservableCollection<string> AllDataTypes = new ObservableCollection<string>()
                                                              {
                                                                  "Object Id",
                                                                  "Trajectory Id",
                                                                  "Date",
                                                                  "Time",
                                                                  "Latitude",
                                                                  "Longitude",
                                                                  "X Coordinate",
                                                                  "Y Coordinate"
                                                              };

        private ObservableCollection<string> _availableDataTypes;
        
        public ObservableCollection<string> AvailableDataTypes
        {
            get
            {
                if(_availableDataTypes == null)
                {
                    string[] tempArray = new string[AllDataTypes.Count];
                    AllDataTypes.CopyTo(tempArray, 0); //copiees the values not the reference
                    return new ObservableCollection<string>(tempArray);
                }
                return _availableDataTypes;
            }
            set { _availableDataTypes = value; }
        }

        public Dictionary<int, string> LockedInDatasetOrder { get; set; } 
        //delimited string index, data type used to define the order the dataset
    }
}
